package com.yidu.best.systemManagement.Authority.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class AuthorityResource implements Serializable {
	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -8180211184307414686L;

	/**
	 * 资源Id
	 */
	private String resourceId;

	/**
	 * 资源名
	 */
	private String resourceName;

	/**
	 * 父资源Id
	 */
	private String parentId;

	/**
	 * 父资源名
	 */
	private String parentName;

	private String resourceUrl;
	
	private List<AuthorityResource> children = new ArrayList<AuthorityResource>();

	public AuthorityResource() {
	}

	public AuthorityResource(String resourceId, String resourceName, String parentId, String parentName,
			String resourceUrl, List<AuthorityResource> children) {
		super();
		this.resourceId = resourceId;
		this.resourceName = resourceName;
		this.parentId = parentId;
		this.parentName = parentName;
		this.resourceUrl = resourceUrl;
		this.children = children;
	}

	@Override
	public String toString() {
		return "AuthorityResource [resourceId=" + resourceId + ", resourceName=" + resourceName + ", parentId="
				+ parentId + ", parentName=" + parentName + ", resourceUrl=" + resourceUrl + ", children=" + children
				+ "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((children == null) ? 0 : children.hashCode());
		result = prime * result + ((parentId == null) ? 0 : parentId.hashCode());
		result = prime * result + ((parentName == null) ? 0 : parentName.hashCode());
		result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode());
		result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
		result = prime * result + ((resourceUrl == null) ? 0 : resourceUrl.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AuthorityResource other = (AuthorityResource) obj;
		if (children == null) {
			if (other.children != null)
				return false;
		} else if (!children.equals(other.children))
			return false;
		if (parentId == null) {
			if (other.parentId != null)
				return false;
		} else if (!parentId.equals(other.parentId))
			return false;
		if (parentName == null) {
			if (other.parentName != null)
				return false;
		} else if (!parentName.equals(other.parentName))
			return false;
		if (resourceId == null) {
			if (other.resourceId != null)
				return false;
		} else if (!resourceId.equals(other.resourceId))
			return false;
		if (resourceName == null) {
			if (other.resourceName != null)
				return false;
		} else if (!resourceName.equals(other.resourceName))
			return false;
		if (resourceUrl == null) {
			if (other.resourceUrl != null)
				return false;
		} else if (!resourceUrl.equals(other.resourceUrl))
			return false;
		return true;
	}

	public String getResourceId() {
		return resourceId;
	}

	public void setResourceId(String resourceId) {
		this.resourceId = resourceId;
	}

	public String getResourceName() {
		return resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public String getResourceUrl() {
		return resourceUrl;
	}

	public void setResourceUrl(String resourceUrl) {
		this.resourceUrl = resourceUrl;
	}

	public List<AuthorityResource> getChildren() {
		return children;
	}

	public void setChildren(List<AuthorityResource> children) {
		this.children = children;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
